home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #3
/
Amiga Plus CD - 2002 - No. 03.iso
/
AmiSoft
/
Util
/
Misc
/
Lottery2002.lha
/
Lottery2002
/
Source
/
main.c
< prev
Wrap
C/C++ Source or Header
|
2003-02-09
|
3KB
|
100 lines
/* main.c */
#include "includes.h"
/* Library Bases */
struct Library *WindowBase = NULL;
struct Library *LayoutBase = NULL;
struct Library *LabelBase = NULL;
struct Library *ButtonBase = NULL;
struct Library *FuelGaugeBase = NULL;
struct Library *TranslatorBase = NULL;
/* Global structures & Variables */
struct Menu *g_menustrip;
struct Requester myreq;
struct MsgPort *speakMP;
struct narrator_rb *speakIO;
int seed;
char g_button[] = "Quit Program";
char g_okbutton[] = "OK";
char g_title[] = "Resource Allocation Failure";
char g_scrtitle[] = "Lottery2002(OS3.5/9) V2.1 © T.Collier 2002";
char *VERSION = "\0$VER: Lottery2002 2.1 (08.03.02) T.Collier";
enum
{
GAD_FIRST=0,
GAD_BOX1, GAD_BOX2, GAD_BOX3, GAD_BOX4, GAD_BOX5, GAD_BOX6,
GAD_BOX7, GAD_BOX8, GAD_BOX9, GAD_BOX10, GAD_BOX11, GAD_BOX12,
GAD_FUEL, GAD_START, GAD_SPEAK, GAD_QUIT,
GAD_LAST
};
int wednums[6], satnums[6];
BOOL spk_flag = FALSE;
BPTR filelock = NULL;
/* Starts from here if called from WorkBench */
#ifdef __STORM__ // Storm Compiler
void wbmain(struct WBStartup *wbs)
{
main( 0, NULL);
}
#endif
void main(int argc, char *argv[])
{
/* make sure our classes opened, exit if not */
if(!(ButtonBase = (struct Library *)OpenLibrary("gadgets/button.gadget",44)))
cleanexit(requester(g_title,
"\nCould NOT OPEN button.image V44.\n", g_button));
if(!(FuelGaugeBase = (struct Library *)OpenLibrary("gadgets/fuelgauge.gadget",44)))
cleanexit(requester(g_title,
"\nCould NOT OPEN fuelgauge.image V44.\n", g_button));
if(!(WindowBase = (struct Library *)OpenLibrary("window.class",44)))
cleanexit(requester(g_title,
"\nCould NOT OPEN window.class V44.\n", g_button));
if(!(LayoutBase = (struct Library *)OpenLibrary("gadgets/layout.gadget",44)))
cleanexit(requester(g_title,
"\nCould NOT OPEN layout.gadget V44.\n", g_button));
if(!(LabelBase = (struct Library *)OpenLibrary("images/label.image",44)))
cleanexit(requester(g_title,
"\nCould NOT OPEN label.image V44.\n", g_button));
if(TranslatorBase = OpenLibrary("translator.library", 36L))
{
BPTR filelock = NULL;
if((filelock) = Lock("Devs:narrator.device", ACCESS_READ))
{
spk_flag = TRUE;
UnLock(filelock);
}
}
seed = (int)time(NULL); // use time function to set the random seed
srand(seed);
opengui();
cleanexit(0);
}
/* Close the classes */
void cleanexit(int returnvalue)
{
if(ButtonBase) CloseLibrary(ButtonBase);
if(FuelGaugeBase) CloseLibrary(FuelGaugeBase);
if(LabelBase) CloseLibrary(LabelBase);
if(LayoutBase) CloseLibrary(LayoutBase);
if(WindowBase) CloseLibrary(WindowBase);
if(TranslatorBase) CloseLibrary(TranslatorBase);
exit(returnvalue);
}